using UnityEngine;

public class butScrollRoom : MonoBehaviour
{
	public UILabel labelKolPlayers;

	public UILabel labelNameRoom;

	public UILabel labelNameLevel;

	public GameObject sprLock;

	public GameObject sprUnlock;

	public string nameRoom = string.Empty;

	public string password = string.Empty;

	[HideInInspector]
	public RoomInfo infoRoom;

	private void OnClick()
	{
		FlurryWrapper.LogEvent(FlurryWrapper.EV_LAUNCH_ROOM);
		settings.playSoundButton();
		if (password.Equals(string.Empty))
		{
			controllerConnectPhoton.thisScript.joinRoomName(nameRoom);
			return;
		}
		Save.SaveString(settings.keyRoomName, nameRoom);
		Save.SaveString(settings.keyRoomPass, password);
		controllerMenu.thisScript.showEnterPassword();
	}

	public void SetInfoRoom(RoomInfo needRoom)
	{
		infoRoom = needRoom;
		nameRoom = infoRoom.name;
		if (labelKolPlayers != null)
		{
			labelKolPlayers.text = string.Empty + infoRoom.playerCount + "/" + infoRoom.maxPlayers;
		}
		if (labelNameRoom != null)
		{
			if (infoRoom.name.Length == 36 && infoRoom.name.IndexOf("-") == 8 && infoRoom.name.LastIndexOf("-") == 23)
			{
				labelNameRoom.text = "Random Server";
			}
			else
			{
				labelNameRoom.text = FilterBadWorld.FilterString(infoRoom.name);
			}
		}
		password = infoRoom.customProperties["pass"].ToString();
		bool flag = password.Equals(string.Empty);
		sprLock.SetActive(!flag);
		sprUnlock.SetActive(flag);
		if (labelNameLevel != null)
		{
			string nameLevelByNameScene = ManagerPVPLevels.instance.GetNameLevelByNameScene(infoRoom.customProperties["nameLevel"].ToString());
			labelNameLevel.text = nameLevelByNameScene;
		}
	}
}
